package day7;

import day1.Dog;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @author oldliu
 * @since 1.0
 */
public class DogTest {
    public static void main(String[] args) throws ClassNotFoundException {
        Dog d=new Dog("小花花",66,77,"土狗");
        Class<Dog> c = Dog.class;
        Class c2=int.class;
        System.out.println(c.getName());
        Class c3=Class.forName("day1.Dog");
        Class c4=d.getClass();
        System.out.println(c4==c);
        System.out.println(c==c3);
        System.out.println("父类:"+c.getSuperclass().getName());
        System.out.println("接口："+ Arrays.toString(c.getInterfaces()));
        //属性：
        Field[] fields = c.getDeclaredFields();
        System.out.println("属性：");
        System.out.println(Arrays.toString(fields));
        System.out.println("方法：");
        Method[] methods = c.getDeclaredMethods();
        System.out.println(Arrays.toString(methods));
        System.out.println("构造方法：");
        Constructor<?>[] cr = c.getDeclaredConstructors();
        System.out.println(Arrays.toString(cr));
    }
}
